package ${content.controller.classPackage};

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

import ${content.service.classPackage}.${content.service.className};
import ${content.entity.classPackage}.${content.entity.className};

/**
* ${content.entity.className}的路由接口服务
*
* @author
*
*/
@RestController
@RequestMapping("/${content.entity.className}")
public class ${content.controller.className} {

/** I${content.entity.className}Service服务 */
@Autowired
private ${content.service.className} ${content.service.className?uncap_first};


@GetMapping("/getById")
public ${content.entity.className} getById(String id){
LambdaQueryWrapper<${content.entity.className}> lambda=new QueryWrapper<${content.entity.className}>().lambda();
lambda.eq(${content.entity.className}::getId,id);
${content.entity.className} one = ${content.service.className?uncap_first}.getOne(lambda);
return one;
}


@PostMapping("/save")
public boolean save(@RequestBody ${content.entity.className} entity){
boolean save = ${content.service.className?uncap_first}.save(entity);

return save;

}

@PostMapping("/list")
public List <TUser> list( ){
    List<${content.entity.className}> list = ${content.service.className?uncap_first}.list();
    return list;

    }

    @PostMapping("/deleteByIds")
    public boolean deleteByIds(@RequestBody List<String> ids ){
        boolean b = ${content.service.className?uncap_first}.removeByIds(ids);
        return b;
        }

 }
